package com.snowleopard.findpeople.entity.publish;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.snowleopard.common.base.BaseEntity;
import com.snowleopard.findpeople.entity.position.Area;
import com.snowleopard.findpeople.entity.position.Trade;

/**
 * InfoPublish.
 */
@Entity
@Table(name = "publ_info_publish")
public class InfoPublish extends BaseEntity {

    private static final long serialVersionUID = 996513837889330853L;

    private Area area;
    private Trade trade;
    private String title;
    private String type;
    private String contactWay;
    private String content;
    private List<ImageStorage> imageStorages;

    @Column(length = 50)
    public String getTitle() {
        return title;
    }

    public void setTitle(final String title) {
        this.title = title;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "area_id")
    public Area getArea() {
        return this.area;
    }

    public void setArea(final Area area) {
        this.area = area;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "trade_id")
    public Trade getTrade() {
        return this.trade;
    }

    public void setTrade(final Trade trade) {
        this.trade = trade;
    }

    @Column(length = 100)
    public String getContactWay() {
        return this.contactWay;
    }

    public void setContactWay(final String contactWay) {
        this.contactWay = contactWay;
    }

    @Column(length = 20)
    public String getType() {
        return type;
    }

    public void setType(final String type) {
        this.type = type;
    }

    @Column(length = 255)
    public String getContent() {
        return this.content;
    }

    public void setContent(final String content) {
        this.content = content;
    }

    @OneToMany(mappedBy = "infoPublish", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    public List<ImageStorage> getImageStorages() {
        return imageStorages;
    }

    public void setImageStorages(List<ImageStorage> imageStorages) {
        this.imageStorages = imageStorages;
    }

}
